/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * LoanComputerRoom.java
 *
 * Created on 20/06/2011, 11:25:44 AM
 */

package GUI.ATTENDANT;

import GUI.Customer.Server;
import Procedures.DBConection;
import Procedures.LoanTable;
import javax.swing.JFrame;

/**
 *
 * @author SIX-14
 */
public class LoanComputerRoom extends javax.swing.JPanel {

    /** Creates new form LoanComputerRoom */
    public LoanComputerRoom() {
        initComponents();
    }

    public LoanComputerRoom(DBConection myConection, JFrame paternFrame, LoanTable loantable, Server server) {
        initComponents();
        jButton1.setVisible(false);
        jButton3.setVisible(false);
        this.myConection=myConection;
        this.paternFrame=paternFrame;
        this.loanTable=loantable;
        this.server=server;
    }


    private DBConection myConection;
    private JFrame paternFrame;
    private LoanTable loanTable;
    private Server server;

    public Server getServer() {
        return server;
    }

    public void setServer(Server server) {
        this.server = server;
    }



    public LoanTable getLoanTable() {
        return loanTable;
    }

    public void setLoanTable(LoanTable loanTable) {
        this.loanTable = loanTable;
    }

    public DBConection getMyConection() {
        return myConection;
    }

    public void setMyConection(DBConection myConection) {
        this.myConection = myConection;
    }

    public JFrame getPaternFrame() {
        return paternFrame;
    }

    public void setPaternFrame(JFrame paternFrame) {
        this.paternFrame = paternFrame;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();

        jButton1.setText("Reservar Sala");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });

        jButton2.setText("Prestar Sala");
        jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton2MouseClicked(evt);
            }
        });

        jButton3.setText("Cancelar Reserva Sala");

        jButton4.setText("Terminar Prestamo sala");
        jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton4MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(139, 139, 139)
                        .addComponent(jButton2))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(132, 132, 132)
                        .addComponent(jButton1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(115, 115, 115)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButton3)
                            .addComponent(jButton4))))
                .addContainerGap(140, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(54, 54, 54)
                .addComponent(jButton2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton4)
                .addGap(41, 41, 41)
                .addComponent(jButton1)
                .addGap(18, 18, 18)
                .addComponent(jButton3)
                .addContainerGap(89, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
        ReserverComputerRoom assignerComputerRoom = new ReserverComputerRoom(getMyConection(), getPaternFrame(), getLoanTable());
        getPaternFrame().getContentPane().removeAll();
        getPaternFrame().add(assignerComputerRoom);
        getPaternFrame().pack();
    }//GEN-LAST:event_jButton1MouseClicked

    private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
        AssignerComputerRoom assignerComputerRoom = new AssignerComputerRoom(getMyConection(),getPaternFrame(),getLoanTable(), getServer());
        getPaternFrame().getContentPane().removeAll();
        getPaternFrame().add(assignerComputerRoom);
        getPaternFrame().pack();
    }//GEN-LAST:event_jButton2MouseClicked

    private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton4MouseClicked
        FinisherLoanComputerRoom finisherLoanComputerRoom = new FinisherLoanComputerRoom(getMyConection(),getPaternFrame(),getLoanTable(), getServer());
        getPaternFrame().getContentPane().removeAll();
        getPaternFrame().add(finisherLoanComputerRoom);
        getPaternFrame().pack();
    }//GEN-LAST:event_jButton4MouseClicked


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    // End of variables declaration//GEN-END:variables

}
